package hfjava;

public class YunSuan {
    int num1;
    char operator;
    int num2;


    public int figure(){
        int result=0;
       switch(this.operator){
           case '+':
               result=num1+num2;
               break;
           case '-':
               result=num1-num2;
               break;
           case '*':
               result=num1*num2;
               break;
           case '/':
               if (num2==0){
                   System.out.println("输入有误");
               }else{
                   result=num1/num2;
               }
               break;
           default:
               break;
       }
       return result;

    }
}
